package com.zxy.ziems.server.device.modules.modbus;

import cn.hutool.extra.validation.ValidationUtil;
import com.zxy.ziems.common.pojo.modbus.DeviceConfigModbus;
import com.zxy.ziems.common.pojo.collector.GenericConfig;
import com.zxy.ziems.server.device.pojo.entity.ChannelDeviceEntity;
import com.zxy.ziems.server.device.modules.DeviceChannelProcessor;
import org.springframework.stereotype.Service;

/**
 * 设备的modbus配置处理器
 * @author 10348359
 * @create 2024-03-26 11:14
 */
@Service
public class DeviceConfigModbusProcessor implements DeviceChannelProcessor<DeviceConfigModbus, DeviceConfigModbus> {
    @Override
    public String supportProtocol() {
        return "ModbusTcp";
    }

    @Override
    public void doBeforeEncodeAdvancedConfigActionTrigger(DeviceConfigModbus config, String protocol, String channelId, String deviceId) {
        ValidationUtil.validate(config);
    }

    @Override
    public DeviceConfigModbus doDecodeAdvancedConfig(DeviceConfigModbus config, String protocol, String channelId, String deviceId) {
        return config;
    }
}
